package FromMap;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

import FromDB.FromOracle;

public class ManualData {

	public static void main(String[] args) {
		fromMap();
	}
	
	private static void fromMap() {
		JFreeChart pieChart3D = null;
		JFreeChart pieChart2D = null;
		final DefaultPieDataset pieDataset = new DefaultPieDataset();
		/*
		 * Query used by getNumberEmployeesByLocation() method:
		 * 
		 * SELECT locations.city, count(*) AS num_employees FROM departments,
		 * employees, locations WHERE employees.department_id =
		 * departments.department_id AND departments.location_id =
		 * locations.location_id GROUP BY locations.city
		 */
       
		final String TITLE_EMPS_PER_LOC = "Employees Per Department";
		pieDataset.setValue("Administration",2);
		pieDataset.setValue("Sales",7);
		pieDataset.setValue("Finance",1);
		pieDataset.setValue("Operations",5);
		pieChart3D = ChartFactory.createPieChart3D(TITLE_EMPS_PER_LOC,
				pieDataset, true, true, false);
		pieChart2D = ChartFactory.createPieChart(TITLE_EMPS_PER_LOC,
				pieDataset, true, true, false);
				  
		final String fileName = "d:/EmpsPerLocPieChart3D.jpg";
		final String fileName2d = "d:/EmpsPerLocPieChart2D.jpg";
		try {
			ChartUtilities.writeChartAsJPEG(new FileOutputStream(fileName),pieChart3D, 500, 600);
			ChartUtilities.writeChartAsPNG(new FileOutputStream(fileName2d),
					pieChart2D, 600, 600);
		} catch (IOException ioEx) {
			System.err.println("Error writing JPG file " + fileName);
		}
	}
}
